/*
 * @Description: 
 * @Author: mmzhang
 * @Date: 2021-12-10 16:52:09
 * @LastEditTime: 2023-01-12 14:30:03
 */
import Opt from '@/components/dt/info/Opt.js'
import ProBuildUnit from '@/biz/option/proBuildUnit.js'
import subMgr from '@/biz/sales/subOrder.js'
import dt from '@dt/dt'

let _this = null
let proBuildUnit = new ProBuildUnit()
class SearchOpt extends Opt {

  constructor(vm) {
    _this = vm
    super()
    this.build()
  }

  build() {
    let uploadStatus = {
      title: '附件上传情况',
      key: 'attachmentUpload',
      placeholder: '请选择',
      select: {
        options: dt.dictInfo().annexRepair
      }
    }

    this.createAll()
    this.opts.push(...this.all)

    // 判断是否是附件列表
    if (_this.isFileList) {
      this.opts.push(uploadStatus)
    }
  }


  createAll() {
    this.all = [
      {
        title: '认购状态',
        key: _this.searchInfo.statusList ? 'statusList' : 'status',
        placeholder: '请选择',
        disabled: _this.countType != 0,
        select: {
          options: subMgr.getSubStatus(),
          multiple: true,
          maxTagCount: 1
        },
      },
      ...proBuildUnit.options(_this, false, false,_this.countType!=0)
    ]
  }
}

export default SearchOpt